/**
 * Copyright 2013 Matt Holland <code.monkey.ota at gmail.com>
 *
 * This file is part of BotTender.
 *
 * BotTender is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * BotTender is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with BotTender. If not, see <http://www.gnu.org/licenses/>.
 */


package ota.ircbot.bottender.admin;

import org.pircbotx.PircBotX;
import org.pircbotx.User;
import org.pircbotx.hooks.ListenerAdapter;
import org.pircbotx.hooks.events.PrivateMessageEvent;

public class ShutdownComm extends ListenerAdapter {
	
		
	public void onPrivateMessage(PrivateMessageEvent event) {
		if(event.getMessage().toLowerCase().startsWith(".quit")) {
			if(Authorized.isOwner(event.getUser())) {
				event.getBot().disconnect();
				
			}
			else {
				event.respond("Owner required to issue this command.");
			}
		}
	}

}
